home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 4 / BBS in a Box - Macintosh - Volume IV (January 1992) (BBS in a Box).iso / Files / Prog / M / LSC213.cpt / SoundMgr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1987-09-26  |  2.2 KB  |  138 lines  |  [TEXT/KAHL]

  1.  
  2. /*
  3.  *  SoundMgr.h
  4.  *
  5.  *  Copyright (c) 1986, 1987 THINK Technologies, Inc.
  6.  *  These interfaces are based on information copyrighted
  7.  *  by Apple Computer, Inc., 1985, 1986, 1987.
  8.  *
  9.  */
  10.  
  11. #ifndef _SoundMgr_
  12. #define _SoundMgr_
  13.  
  14. #ifndef _MacTypes_
  15. #include "MacTypes.h"
  16. #endif
  17.  
  18.  
  19. #define synthCodeRsrc        'snth'
  20. #define soundListRsrc        'snd '
  21.  
  22. enum {
  23.     noteSynth = 2,
  24.     waveTableSynth,
  25.     midiSynth,
  26.     sampledSynth
  27. };
  28.  
  29. #define twelfthRootTwo        1.05946309434
  30.  
  31.  
  32. enum {
  33.     nullCmd,
  34.     initCmd,
  35.     freeCmd,
  36.     quietCmd,
  37.     flushCmd,
  38.     waitCmd = 10,
  39.     pauseCmd,
  40.     resumeCmd,
  41.     callBackCmd,
  42.     syncCmd,
  43.     emptyCmd,
  44.     tickleCmd = 20,
  45.     requestNextCmd,
  46.     howOftenCmd,
  47.     wakeUpCmd,
  48.     availableCmd,
  49.     noteCmd = 40,
  50.     restCmd,
  51.     freqCmd,
  52.     ampCmd,
  53.     timbreCmd,
  54.     waveTableCmd = 60,
  55.     phaseCmd,
  56.     soundCmd = 80,
  57.     bufferCmd,
  58.     rateCmd,
  59.     midiDataCmd = 100
  60. };
  61.  
  62. #define setPtrBit            0x8000
  63. #define stdQLength            128
  64.  
  65.  
  66. /* Error codes */
  67. enum {
  68.     badFormat = -206,
  69.     badChannel,
  70.     resProblem,
  71.     queueFull,
  72.     notEnoughHardware = -201,
  73.     noHardware
  74. };
  75.  
  76.  
  77. /* Wave Table Synthesizer */
  78. #define initChanLeft        0x02
  79. #define initChanRight        0x03
  80. #define initChan0            0x04
  81. #define initChan1            0x05
  82. #define initChan2            0x06
  83. #define initChan3            0x07
  84. #define initSRate22k        0x20
  85. #define initSRate44k        0x30
  86. #define initMono            0x80
  87. #define initStereo            0xC0
  88.  
  89.  
  90. /*typedef    long                Time;                /* in half milliseconds */
  91. #define infiniteTime        0x7FFFFFFF
  92.  
  93.  
  94. typedef struct SndCommand {
  95.     short                    cmd;
  96.     short                    param1;
  97.     long                    param2;
  98. } SndCommand;
  99.  
  100.  
  101. typedef struct ModifierStub {
  102.     struct ModifierStub        *nextStub;
  103.     ProcPtr                    code;
  104.     long                    userInfo;
  105.     long /* Time */            count;
  106.     long /* Time */            every;
  107.     char                    flags;
  108.     char                    hState;
  109. } ModifierStub, *ModifierStubPtr;
  110.  
  111.  
  112. typedef struct SndChannel {
  113.     struct SndChannel        *nextChan;
  114.     ModifierStubPtr            firstMod;
  115.     ProcPtr                    callBack;
  116.     long                    userInfo;
  117.     long /* Time */            wait;
  118.     SndCommand                cmdInProgress;
  119.     short                    flags;
  120.     short                    qLength;
  121.     short                    qHead;
  122.     short                    qTail;
  123.     SndCommand                queue[stdQLength];
  124. } SndChannel, *SndChannelPtr;
  125.  
  126.  
  127. typedef struct SoundHeader {
  128.     Ptr                    samplePtr;
  129.     long                length;
  130.     Fixed                sampleRate;
  131.     long                loopStart;
  132.     long                loopEnd;
  133.     short                baseNote;
  134.     char                sampleArea[];
  135. } SoundHeader, *SoundHeaderPtr;
  136.  
  137.  
  138. #endif _SoundMgr_